-- cmd_client_log
-- Create by zouyb
-- 客户端发送本地日志给服务器

function Operation.cmd_client_log(from, to)
    local data = getLogHistory(from, to);
    Operation.send_cmd_client_log(data);
end

function Operation.send_cmd_client_log(data)
    local zlib = require "zlib";
    local buf = zlib.compress(data);
    local b = Buffer.create(4);
    Buffer.setu32(b, 1,  string.len(data));
    Buffer.append(b, buf);

    print(string.format("压缩前:%d, 压缩后:%d", string.len(data), string.len(buf)));

    Communicate.send("CMD_CLIENT_LOG", { ["log"] = b.value, });

end
